home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 April / CMCD0404.ISO / Software / Shareware / Programare / sharp / wwwSharp_setup.exe / {app} / Examples / Data access / DataBindings (DataSet) / index.hta < prev   
Text File  |  2003-12-16  |  2KB  |  73 lines

  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  2. <HTML>
  3. <HEAD>
  4.     <TITLE>www-Sharp.ClrHost DataSet example</TITLE>
  5.     <META name="GENERATOR" content="MSHTML 6.00.2800.1264">
  6.     <META http-equiv="MSThemeCompatible" content="Yes">
  7.     <OBJECT id="dsNorthwind" classid="clsid:A53ECD51-C062-4B08-97F0-4944CD7D88E7">
  8.         <PARAM name="AssemblyName"
  9.             value="System.Data, Version=1.0.5000.0, PublicKeyToken=b77a5c561934e089, Culture=neutral">
  10.         <PARAM name="DataAdapterTypeName" value="System.Data.SqlClient.SqlDataAdapter">
  11.         <PARAM name="ConnectionTypeName" value="System.Data.SqlClient.SqlConnection">
  12.         <PARAM name="ConnectionString" value="Integrated Security=SSPI;Database=Northwind;">
  13.         <PARAM name="TABLE_customers" value="Select * from customers">
  14.     </OBJECT>
  15. <STYLE>
  16. TH
  17. {
  18.     background-color: #99CC33;
  19. }
  20.  
  21. TD
  22. {
  23.     background-color: #00FF99;
  24. }
  25.  
  26. BUTTON
  27. {
  28.     width: 100px;
  29. }
  30. </STYLE>
  31. <SCRIPT>
  32. window.onload = Fill;
  33.  
  34. function Fill()
  35. {
  36.     var i;
  37.     var str = "<TABLE id=\"tblCustomers\" dataSrc=\"#dsNorthwind.customers\" border=\"0\" width=\"100%\" dataPageSize=\"10\">\r\n";
  38.  
  39.     var rs = dsNorthwind.namedRecordset("customers");
  40.     if (rs == null)
  41.     {
  42.         window.alert("Recordset is not valid");
  43.         return;
  44.     }
  45.     
  46.     str += "<THEAD>\r\n<TR>\r\n";
  47.     for (i = 0; i < rs.Fields.Count; i++)
  48.         str += "<TH>" + rs.Fields.Item(i).Name + "</TH>\r\n";
  49.     str += "</TR>\r\n</THEAD>\r\n";
  50.  
  51.     str += "<TBODY>\r\n<TR>\r\n";
  52.     for (i = 0; i < rs.Fields.Count; i++)
  53.         //str += "<TD><INPUT type=\"text\" dataFld=\"" + rs.Fields.Item(i).Name + "\"></TD>\r\n";
  54.         str += "<TD><SPAN dataFld=\"" + rs.Fields.Item(i).Name + "\"></SPAN></TD>\r\n";
  55.     str += "</TR>\r\n</TBODY>\r\n";
  56.     
  57.     str += "</TABLE>";
  58.  
  59.     tblCustomers.outerHTML = str;
  60. }
  61. </SCRIPT>
  62. </HEAD>
  63. <BODY>
  64.     <BUTTON id="btnFirst" onclick="tblCustomers.firstPage()">< <</BUTTON>
  65.     <BUTTON id="btnPrev" onclick="tblCustomers.previousPage()"><</BUTTON>
  66.     <BUTTON id="btnNext" onclick="tblCustomers.nextPage()">></BUTTON>
  67.     <BUTTON id="btnLast" onclick="tblCustomers.lastPage()">> ></BUTTON>
  68.     <TABLE id="tblCustomers">
  69.         <TBODY></TBODY>
  70.     </TABLE>
  71. </BODY>
  72. </HTML>
  73.